package ltd.dujiabao.dex.quartz.exe;

import org.quartz.Scheduler;

import ltd.dujiabao.dex.core.DelayJobEntity;
import ltd.dujiabao.dex.core.ExecutorType;
import ltd.dujiabao.dex.core.emitter.Emitter;
import ltd.dujiabao.dex.core.emitter.EmitterFactory;

/**
 * @author : DuJiabao
 * @Project : common-delay-executor
 * @Time : 2024/3/30 13:52
 * @Desc :
 */
public class QuartzEmitterFactory implements EmitterFactory {

    private final Scheduler scheduler;


    public QuartzEmitterFactory(Scheduler scheduler) {
        this.scheduler = scheduler;
    }

    @Override
    public Emitter getEmitter(DelayJobEntity delayJob) {
        return new QuartzEmitter(delayJob, scheduler);
    }

    @Override
    public ExecutorType executorType() {
        return ExecutorType.QUARTZ;
    }
}
